package faq.biz.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import faq.biz.FaqBiz;
import faq.dao.FaqDao;
import faq.entity.Faq;
import faq.util.MybatisUtil;

public class FaqBizImpl implements FaqBiz{

	@Override
	public List<Faq> getAll() {
		SqlSession sess = MybatisUtil.openSession();
		try {
			FaqDao dao=	sess.getMapper(FaqDao.class);
			List<Faq> faqlist=dao.getAll();
			return faqlist;
		} finally {
			sess.close();
		}
	}

	@Override
	public Faq fectchByCondition(String title) {
		SqlSession sess = MybatisUtil.openSession();
		try {
			FaqDao dao=	sess.getMapper(FaqDao.class);
			Faq faq = dao.fectchByCondition(title);
			return faq;
		} finally {
			sess.close();
		}
	}

	@Override
	public void add() {
		SqlSession sess = MybatisUtil.openSession();
		try {
			FaqDao dao=	sess.getMapper(FaqDao.class);
			dao.add();
			sess.commit();
		} finally {
			sess.close();
		}
		
	}

}
